import mixins from '@/utils/rhMixins.js'
import searchHeader from '@/assets/json/search-header.json'
import vuescroll from 'vuescroll/dist/vuescroll-native'
import {px2rem} from '@/utils/tools'
export default {
  install(Vue) {
    // 注入 mixins  
    Vue.mixin(mixins)

    Vue.use(vuescroll, {
      ops: {
        scrollPanel: {
          easing: "easeOutQuad",
          scrollingX: false,
        },
        bar: {
          background: "rgba(0,0,0,0.2)",
          keepShow: true,
        },
      }, // 在这里设置全局默认配置
    });

    Vue.prototype.$px2rem = px2rem // 放到全局

    Vue.prototype.$getSearchHeader = (vm) => {
      console.log(vm.$route)
        let arr = searchHeader.filter(search => search.name == vm.$route.name)
        if(arr.length == 0) {
            console.error('未找到此页面列表搜索头，请确认之后重试')
            return {btnList: [], selectList: []}
        } 
        let item = arr[0].prop
        item.btnList = item.btnList ? item.btnList.filter(btn => btn.isShow) : []
        item.selectList = item.selectList || []
        return item
    }
  }
};